﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using GMS.Model;
using GMS.BLL;
using System.Collections.Generic;
//using GMS.Utils.ServiceContext;
using GMS.Web.CommonPage;
using GMS.Utils;
using Maticsoft.DBUtility;

public partial class System_UserRight : System.Web.UI.Page
{
    SysFunModuleAccessBLL ModuleManager = new SysFunModuleAccessBLL();
    //CityOrderBLL cityManager = new CityOrderBLL();
    UserAccessBLL userBll = new UserAccessBLL();
    //UserRoleBLL userRoleBll = new UserRoleBLL();
    ComOperate CDO = new ComOperate();
    UserModuleRightAccessBll umrb = new UserModuleRightAccessBll();
    //UserCityRightBll ucrb = new UserCityRightBll();
    string sUserId = string.Empty;
    static string rybh;

    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Session["_UserInfo"] == null)
        //{
        //    Response.Write("<script>alert('登陆已过期，请重新登陆！');top.location.href='" + Request.ApplicationPath + "/Login.aspx';</script>");
        //    return;
        //}
        if(Session["_UserInfo"] != null)
            rybh = ((DataTable)Session["_UserInfo"]).Rows[0]["UserAccount"].ToString();
        if (!IsPostBack)
        {
            CreateCompanyDeptTreeView();

            DataTable modelDt = null;
            if ((int)EnumHelper.E_DbType.DB_ACCESS == PubConstant.GetDBType())
            {
                SysFunModuleAccessBLL bll = new SysFunModuleAccessBLL();
                modelDt = bll.GetList("");
            }
            else if ((int)EnumHelper.E_DbType.DB_SQL == PubConstant.GetDBType())
            {
                SysFunModuleBLL bll = new SysFunModuleBLL();
                modelDt = bll.GetList("");
            }
            else if ((int)EnumHelper.E_DbType.DB_ORACLE == PubConstant.GetDBType())
                return;//
            else
                return;                

            
            LoadMenu(tvModuleRight.Nodes, null,modelDt);
            CreateCityTreeView();

            ViewState["UserExpression"] = "";
            ViewState["selectedUserList"] = new List<string>();
            Session["_currentGridViewPageIndex"] = 0;
            InitGridviePagewInfo();
        }
    }

    public void CreateCompanyDeptTreeView()
    {
        TreeNode tnCompany = new TreeNode();
        TreeNode tnDepartment = new TreeNode();
        DataTable dt = userBll.GetCompanyDeptList();
        string temp2 = "";
        int i;
        string temp = "";

        TreeNode tnAllCompany = new TreeNode("全省");
        tvUser.Nodes.Add(tnAllCompany);
        for (i = 0; i < dt.Rows.Count; i++)
        {
            //新建一个节点
            if (dt.Rows[i]["COMPANY"].ToString() != temp)
            {
                temp = dt.Rows[i]["COMPANY"].ToString();
                tnCompany = new TreeNode(temp);
                //tnAllCompany.ChildNodes.Add(tnCompany);
                tvUser.Nodes.Add(tnCompany);
                tnCompany.CollapseAll();
                temp2 = dt.Rows[i]["DEPARTMENT"].ToString();

                tnDepartment = new TreeNode(temp2);
                tnCompany.ChildNodes.Add(tnDepartment);
                //tnDepartment.CollapseAll();
            }
            else 
            {
                temp2 = dt.Rows[i]["DEPARTMENT"].ToString();
                tnDepartment = new TreeNode(temp2); 
                tnCompany.ChildNodes.Add(tnDepartment);
                //tnDepartment.CollapseAll();
            }
        }
        //tvUser.Nodes.Add(tnAllCompany);
    }

    //显示用户
    protected void InitGridViewByUser()
    {
        ToSetCheckboxStatus();
        string strExpression = ViewState["UserExpression"] != null ? ViewState["UserExpression"].ToString() : "";
        SqlDataSource1.FilterExpression = strExpression;

        GridViewUserList.DataBind();
        InitGridviePagewInfo();
    }
    //换页事件
    protected void GridViewUserList_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        string strExpression = ViewState["UserExpression"].ToString();
        SqlDataSource1.FilterExpression =strExpression;
        ToSetCheckboxStatus();
    }
    //排序事件
    protected void GridViewUserList_OnSorting(object sender, GridViewSortEventArgs e)
    {
        string strExpression = ViewState["UserExpression"].ToString();
        SqlDataSource1.FilterExpression = strExpression;
        ToSetCheckboxStatus();
    }
    //全选用户事件
    protected void BtnSelectAllUser_Click(object sender, EventArgs e)
    {
        if (CB_AllUser.Checked)
        {
            string strExpression = ViewState["UserExpression"] != null ? ViewState["UserExpression"].ToString() : "";
            List<GMS.Model.User> modelList = ViewState["AllUserList"] != null && strExpression.Equals(SqlDataSource1.FilterExpression) ? (List<GMS.Model.User>)ViewState["AllUserList"] : userBll.GetModelList(strExpression);
            ViewState["AllUserList"] = modelList;
            List<string> selectedUserList = new List<string>();
            foreach (GMS.Model.User mode in modelList)
            {
                selectedUserList.Add(mode.UserAccount);
            }
            ViewState["selectedUserList"] = selectedUserList;
        }
        else
            ViewState["selectedUserList"] = new List<string>();
        //this.Page.RegisterStartupScript("", "<script>selectAll('CB_AllUser','CB_selectToSet');</script>");
    }

    protected void GridViewUserList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        List<string> selectedUserList = ViewState["selectedUserList"] != null ? (List<string>)ViewState["selectedUserList"] : new List<string>();
        //首先判断是否是数据行
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#D0E3EE'");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
            //((LinkButton)e.Row.FindControl("LB_UserAccount")).Style.Add("text-decoration", "none");
            if (selectedUserList.Contains(GridViewUserList.DataKeys[e.Row.RowIndex].Value.ToString()))
                ((CheckBox)e.Row.FindControl("CB_selectToSet")).Checked = true;
        }
    }

    protected void GridViewUserList_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "ToShowUserRight")
        {
            int index = Convert.ToInt32(e.CommandArgument);
            string userid =GridViewUserList.DataKeys[index].Value.ToString() ;
            string UserAccount = ((LinkButton)GridViewUserList.Rows[index].FindControl("LB_UserAccount")).Text;
            ((CheckBox)GridViewUserList.Rows[index].FindControl("CB_selectToSet")).Checked = true;
            GridViewUserList.Rows[index].BackColor = System.Drawing.Color.FromName("#A8DEEC");
            foreach (GridViewRow row in GridViewUserList.Rows)
            {
                if (row.RowIndex != index )
                {
                    if (row.RowIndex % 2 == 0)
                        row.BackColor = System.Drawing.Color.FromName("#F7F6F3");
                    else
                        row.BackColor = System.Drawing.Color.White;
                }
            }
            SetModuleRight(UserAccount);
            SetCityRight(UserAccount);
        }
    }

    //设置当前用户列表选中状态
    protected void ToSetCheckboxStatus()
    {
        List<string> selectedUserList = (List<string>)ViewState["selectedUserList"];
        foreach (GridViewRow row in GridViewUserList.Rows)
        {
            CheckBox cb = ((CheckBox)row.FindControl("CB_selectToSet"));
            if (cb.Checked && !selectedUserList.Contains(GridViewUserList.DataKeys[row.RowIndex].Value.ToString()))
                selectedUserList.Add(GridViewUserList.DataKeys[row.RowIndex].Value.ToString());
            else if (!cb.Checked && selectedUserList.Contains(GridViewUserList.DataKeys[row.RowIndex].Value.ToString()))
                selectedUserList.Remove(GridViewUserList.DataKeys[row.RowIndex].Value.ToString());
        }
        ViewState["selectedUserList"] = selectedUserList;
    }

    public void LoadMenu(TreeNodeCollection nodes, int? intParentID, DataTable modelDt)
    {
        String strExpression = String.Empty;
        if (intParentID == null)
            strExpression = "FATHERMODULEID is null";
        else
            strExpression = "FATHERMODULEID =" + intParentID;

        DataRow[] dr = modelDt.Select(strExpression);
        for (int i = 0; i < dr.Length; i++)
        {
            //新建一个节点
            TreeNode tn = new TreeNode();
            tn.Text = dr[i]["MODULENAME"].ToString() + dr[i]["MODULESEQ"].ToString();
            tn.Value = dr[i]["TABSYSID"].ToString();
            if (dr[i]["ISUNFOLD"].ToString() == "0")
                tn.Expanded = false;
            else
                tn.Expanded = true;
            nodes.Add(tn);

            LoadMenu(tn.ChildNodes, Convert.ToInt32(tn.Value),modelDt);
        }
    }

    public void CreateCityTreeView()
    {
        //TreeNode tn;
        ////注意：如果没有按照升序查找，下面的代码可能会出错，也就是说必须先排根节点（-1）
        ////List<SysFunModule> ModuleList = ModuleManager.GetModelListAsc();
        ////GMS.Model.CityOrder co = cityManager.GetModel(DateTime.Now.Year.ToString());
        //List<GMS.Model.CitySeq> csList = new List<CitySeq>();
        //OperationPrincipal op = new OperationPrincipal();
        //if (Session["OperationPrincipal"] != null)
        //{
        //    op = (OperationPrincipal)Session["OperationPrincipal"];
        //    csList = op.AllCityList;
        //}
        ////List<GMS.Model.CityOrder> ModuleList = cityManager.GetModelList(""); 
        //int i, j, k;
        //TreeNode tnSelect = new TreeNode("查询", "Select");
        //this.tvCityRight.Nodes.Add(tnSelect);
        //TreeNode tnAdd = new TreeNode("增加", "Add");
        //this.tvCityRight.Nodes.Add(tnAdd);
        //TreeNode tnUpdate = new TreeNode("修改", "Update");
        //this.tvCityRight.Nodes.Add(tnUpdate);
        //TreeNode tnDelete = new TreeNode("删除", "Delete");
        //this.tvCityRight.Nodes.Add(tnDelete);
        //tnSelect.CollapseAll();
        //tnAdd.CollapseAll();
        //tnDelete.CollapseAll();
        //tnUpdate.CollapseAll();

        //for (i = 0; i < csList.Count; i++)
        //{
        //    //新建一个节点
        //    tn = new TreeNode(csList[i].citycode.ToString() + "-" + csList[i].cityname.ToString(), csList[i].citycode.ToString());
        //    try
        //    {
        //        tnSelect.ChildNodes.Add(new TreeNode(csList[i].citycode.ToString() + "-" + csList[i].cityname.ToString(), csList[i].citycode.ToString()));
        //        tnAdd.ChildNodes.Add(new TreeNode(csList[i].citycode.ToString() + "-" + csList[i].cityname.ToString(), csList[i].citycode.ToString()));
        //        tnUpdate.ChildNodes.Add(new TreeNode(csList[i].citycode.ToString() + "-" + csList[i].cityname.ToString(), csList[i].citycode.ToString()));
        //        tnDelete.ChildNodes.Add(new TreeNode(csList[i].citycode.ToString() + "-" + csList[i].cityname.ToString(), csList[i].citycode.ToString()));
        //    }
        //    catch
        //    {
        //        continue;
        //    }
        //}
    }

    public string GetTrueFromTreeView(TreeNode tn, string lsUserModule)
    {
        if (tn.Checked)
        {
            lsUserModule += ","+tn.Value;
        }
        foreach (TreeNode n in tn.ChildNodes)
        {
            lsUserModule = GetTrueFromTreeView(n, lsUserModule);
        }
        return lsUserModule;
    }

    public string GetCheckedModuls()
    {
        string lsUserModule = "";
        for (int i = 0; i < this.tvModuleRight.Nodes.Count; ++i)
        {
            lsUserModule = GetTrueFromTreeView(this.tvModuleRight.Nodes[i], lsUserModule);
        }
        return lsUserModule.Length > 0 ? lsUserModule.Substring(1) : "";
    }

    public void SetModuleRight(object sender, EventArgs e)
    {
        ToSetCheckboxStatus();
        int iReturn = 0;
        string sMesg = string.Empty;
        int iAction = int.Parse(((Button)sender).CommandArgument);
        string users = GetSelectedUsers();
        string moduls = GetCheckedModuls();
        if(users == null || users == "")
            this.Page.RegisterClientScriptBlock("toAlert", "<script>alert('请先选择用户!');</script>");
        else if (iAction != 0 && (moduls == null || moduls == ""))
            this.Page.RegisterClientScriptBlock("toAlert", "<script>alert('请先选要" + (iAction == 1 ? "添加" : "去除") + "模块权限!');</script>");
        else
        {
            try
            {
                iReturn = umrb.SetUserModulRights(iAction, users, moduls, rybh);
            }
            catch (Exception)
            {
                iReturn = 0;
            }
            if (iReturn == 1)
                sMesg = "配置权限成功";
            else
                sMesg = "配置权限出错";
            this.Page.RegisterClientScriptBlock("toAlert", "<script>alert('" + sMesg + "');</script>");//关闭窗口
        }
    }
    /// <summary>
    /// 设置当前点击用户的权限选中状态
    /// </summary>
    /// <param name="sUserId"></param>
    public void SetModuleRight(string sUserId)
    {
        string sWhere = "UserAccount = '" + sUserId + "'";
        List<UserModuleRightModel> lsUserModule = umrb.GetModelList(sWhere);
        List<int> moduleRights = new List<int>();
        foreach (UserModuleRightModel model in lsUserModule)
        {
            moduleRights.Add((int)model.TABSYSID);
        }
        SetCheckedForModuleTreeView(tvModuleRight.Nodes, moduleRights);

    }
    /// <summary>
    /// 加载角色模块权限
    /// </summary>
    /// <param name="modelDt"></param>
    /// <param name="nodes"></param>
    /// <param name="intParentID"></param>
    private void SetCheckedForModuleTreeView(TreeNodeCollection nodes, List<int> moduleRights)
    {
        for (int i = 0; i < nodes.Count; i++)
        {
            TreeNode tn = nodes[i];
            tn.Checked = moduleRights.Contains(int.Parse(tn.Value));
            SetCheckedForModuleTreeView(nodes[i].ChildNodes, moduleRights);
        }
    }

    protected void SetCityRight(object sender, EventArgs e)
    {
        //ToSetCheckboxStatus();
        //int iReturn = 0;
        //int iAction = int.Parse(((Button)sender).CommandArgument);
        //string sMesg = string.Empty;
        //string users = GetSelectedUsers();
        //List<UserCityRightModel> lsCityRightModel = new List<UserCityRightModel>();

        //if (users == null || users =="")
        //{
        //    this.Page.RegisterClientScriptBlock("toAlert", "<script>alert('请选择用户');</script>");//关闭窗口
        //}
        //else
        //{
        //    lsCityRightModel.Clear();
        //    for (int i = 0; i < tvCityRight.Nodes[0].ChildNodes.Count; ++i)
        //    {
        //        TreeNode tnCityRight0 = tvCityRight.Nodes[0].ChildNodes[i];
        //        TreeNode tnCityRight1 = tvCityRight.Nodes[1].ChildNodes[i];
        //        TreeNode tnCityRight2 = tvCityRight.Nodes[2].ChildNodes[i];
        //        TreeNode tnCityRight3 = tvCityRight.Nodes[3].ChildNodes[i];
        //        if (tnCityRight0.Checked || tnCityRight1.Checked || tnCityRight2.Checked || tnCityRight3.Checked)
        //        {
        //            UserCityRightModel CityModel = new UserCityRightModel();
        //            CityModel.UserAccount = "";
        //            CityModel.CITYCODE = tnCityRight0.Value;
        //            CityModel.SEARCHRIGHT = (tnCityRight0.Checked ? 1 : 0);
        //            CityModel.INSERTRIGHT = (tnCityRight1.Checked ? 1 : 0);
        //            CityModel.UPDATERIGHT = (tnCityRight2.Checked ? 1 : 0);
        //            CityModel.DELETERIGHT = (tnCityRight3.Checked ? 1 : 0);
        //            lsCityRightModel.Add(CityModel);
        //        }
        //    }
        //    if (iAction != 0 && (lsCityRightModel == null || lsCityRightModel.Count == 0))
        //        this.Page.RegisterClientScriptBlock("toAlert", "<script>alert('请选择要" + (iAction == 1 ? "添加" : "去除") + "分公司权限!');</script>");
        //    else
        //    {
        //        try
        //        {
        //            iReturn = ucrb.SetUserCityRights(iAction, users, lsCityRightModel, rybh);
        //        }
        //        catch (Exception)
        //        {
        //            iReturn = 0;
        //        }
        //        if (iReturn == 1)
        //            sMesg = "配置分公司权限成功";
        //        else
        //            sMesg = "配置分公司权限出错";
        //        this.Page.RegisterClientScriptBlock("toAlert", "<script>alert('" + sMesg + "');</script>");//关闭窗口
        //    }
        //}
    }

    public void SetCityRight(string sUserId)
    {
        //int iCount = 0;
        //string sWhere = "UserAccount = '" + sUserId + "'";
        //List<UserCityRightModel> lsCityModel = ucrb.GetModelList(sWhere);
        //iCount = tvCityRight.CheckedNodes.Count;
        //for (int i = 0; i < iCount; ++i)
        //{
        //    tvCityRight.CheckedNodes[0].Checked = false;
        //}

        //for (int i = 0; i < lsCityModel.Count; ++i)
        //{
        //    UserCityRightModel CityModel = (UserCityRightModel)lsCityModel[i];
        //    if (CityModel.SEARCHRIGHT == 1)
        //    {
        //        SetCityTreeTrue(tvCityRight.Nodes[0], CityModel.CITYCODE);
        //    }
        //    if (CityModel.INSERTRIGHT == 1)
        //    {
        //        SetCityTreeTrue(tvCityRight.Nodes[1], CityModel.CITYCODE);
        //    }
        //    if (CityModel.UPDATERIGHT == 1)
        //    {
        //        SetCityTreeTrue(tvCityRight.Nodes[2], CityModel.CITYCODE);
        //    }
        //    if (CityModel.DELETERIGHT == 1)
        //    {
        //        SetCityTreeTrue(tvCityRight.Nodes[3], CityModel.CITYCODE);
        //    }
        //}
    }

    public void SetCityTreeTrue(TreeNode tn, string sCityCode) 
    {
        //for (int i = 0; i < tn.ChildNodes.Count; ++i)
        //{
        //    if (tn.ChildNodes[i].Value.Equals(sCityCode))
        //    {
        //        tn.ChildNodes[i].Checked = true;
        //        break;
        //    }
        //}
    }

    //单击用分公司或者部门时,查询相关用户信息
    protected void tvUser_SelectedNodeChanged(object sender, EventArgs e)
    {
        //执行查询之前,将当前页的选中状态保存
        ToSetCheckboxStatus();

        TreeView tvObj = (TreeView)sender;
        string strExpression = "";
        if (tvObj.SelectedNode.Text == "全省")
            strExpression = "";
        else if (tvObj.SelectedNode.Parent != null)
            strExpression = "company='" + tvObj.SelectedNode.Parent.Text + "' and department='" + tvObj.SelectedNode.Text + "'";
        else
            strExpression = "company='" + tvObj.SelectedNode.Text + "'";

        ViewState["UserExpression"] = strExpression;
        InitGridViewByUser();

    }
    //查询
    protected void btnRinght_ServerClick(object sender, EventArgs e)
    {
        //执行查询之前,将当前页的选中状态保存
        ToSetCheckboxStatus();

        string strExpression = " UserAccount like '%" + txUserInfo.Value + "%' or username like '%" + txUserInfo.Value + "%'";
        ViewState["UserExpression"] = strExpression;
        InitGridViewByUser();
        
        //当只查到一个记录时,显示该用户的授权信息,及选中状态,如有需要可展开左边用户所属分公司
        if (GridViewUserList.Rows.Count == 1)
        {
            string UserAccount = ((LinkButton)GridViewUserList.Rows[0].FindControl("LB_UserAccount")).Text;
            SetModuleRight(UserAccount);
            SetCityRight(UserAccount);
        }
        
    }
    protected string GetSelectedUsers()
    {
        List<string> lsUser = (List<string>)ViewState["selectedUserList"];
        string users = "";
        for (int i = 0; i < lsUser.Count; i++)
        {
            users += ",'" + lsUser[i].ToString() + "'";
        }
        return users.Length > 0 ? users.Substring(1) : "";
    }

    /// <summary>
    /// 设置分页信息
    /// </summary>
    protected void InitGridviePagewInfo()
    {
        GridViewUserList.PageIndex = int.Parse(Session["_currentGridViewPageIndex"].ToString()) > GridViewUserList.PageCount - 1 ? 0 : int.Parse(Session["_currentGridViewPageIndex"].ToString());
        GridViewUserList.DataBind();
        lblAllRow.Text = GetGridviewTotalRows().ToString();                     //共几行
        if (GridViewUserList.PageCount <= 1)
        {
            LbtFirstPage.Enabled = false;
            LbtPreviousPage.Enabled = false;
            LbtNextPage.Enabled = false;
            LbtLastPage.Enabled = false;
        }
        else if (GridViewUserList.PageIndex == 0)
        {
            LbtFirstPage.Enabled = false;
            LbtPreviousPage.Enabled = false;
            LbtNextPage.Enabled = true;
            LbtLastPage.Enabled = true;
        }
        else if (GridViewUserList.PageIndex == GridViewUserList.PageCount - 1)
        {
            LbtFirstPage.Enabled = true;
            LbtPreviousPage.Enabled = true;
            LbtNextPage.Enabled = false;
            LbtLastPage.Enabled = false;
        }
        else
        {
            LbtFirstPage.Enabled = true;
            LbtPreviousPage.Enabled = true;
            LbtNextPage.Enabled = true;
            LbtLastPage.Enabled = true;
        }
    }
    /// <summary>
    /// 获得总行数
    /// </summary>
    /// <returns></returns>
    protected int GetGridviewTotalRows()
    {
        int currentPage = GridViewUserList.PageIndex;
        int totalRows = 0;
        if (GridViewUserList.PageCount > 0)                            //如果页数大于0
        {
            GridViewUserList.PageIndex = GridViewUserList.PageCount - 1;      //将当前显示页的索引转到最后一页    
            GridViewUserList.DataBind();                               //重新绑定数据，这是十分重要，这样才能到达最后一页
            totalRows = GridViewUserList.Rows.Count;                   //然后获得最后一页的行数
            if (GridViewUserList.PageCount > 1)                        //如果页数大于1页，则计算出
            {                                                   //总行数=（总页数-1）* 每页行数 +  最后一页的行数
                totalRows = GridViewUserList.PageSize * (GridViewUserList.PageCount - 1) + totalRows;
            }
            GridViewUserList.PageIndex = currentPage;
            GridViewUserList.DataBind();
        }
        return totalRows;
        //string strExpression = ViewState["UserExpression"] != null ? ViewState["UserExpression"].ToString() : "";
        //List<GMS.Model.User> modelList = ViewState["AllUserList"] != null && strExpression.Equals(SqlDataSource1.FilterExpression) ? (List<GMS.Model.User>)ViewState["AllUserList"] : userBll.GetModelList(strExpression);
        //ViewState["AllUserList"] = modelList;
        //return modelList.Count;
    }

    /// <summary>
    /// 首页按钮
    /// </summary>
    protected void FirstPageClick(object sender, EventArgs e)
    {
        Session["_currentGridViewPageIndex"] = 0;
        InitGridViewByUser();
    }
    /// <summary>
    /// 上一页
    /// </summary>
    protected void PreviousPageClick(object sender, EventArgs e)
    {
        if (GridViewUserList.PageIndex > 0)
        {
            Session["_currentGridViewPageIndex"] = GridViewUserList.PageIndex - 1;
            InitGridViewByUser();
        }
    }
    /// <summary>
    /// 下一页
    /// </summary>
    protected void NextPageClick(object sender, EventArgs e)
    {
        if (GridViewUserList.PageIndex < GridViewUserList.PageCount - 1)
        {
            Session["_currentGridViewPageIndex"] = GridViewUserList.PageIndex + 1;
            InitGridViewByUser();
        }
    }
    /// <summary>
    /// 尾页
    /// </summary>
    protected void LastPageClick(object sender, EventArgs e)
    {
        Session["_currentGridViewPageIndex"] = GridViewUserList.PageCount - 1;
        InitGridViewByUser();
    }
}
